package fx.game.demo.common;

import fx.game.demo.button.ColorsButton;
import fx.game.demo.button.ConfirmButton;
import fx.game.demo.button.OpenAboutButton;
import fx.game.demo.button.ResetButton;
import fx.game.demo.event.ButtonEvent;

import java.util.Optional;

/**
 *
 * @author: datom
 *
 * @create: 2021/12/6 17:57
 *
 * @Deprecated 按钮管理器
 *
 **/
public class ButtonManage {

    /**
     * 重置按钮
     */
    private static ResetButton resetButton;

    /**
     * 颜色按钮
     */
    private static ColorsButton colorsButton;

    /**
     * 确定按钮
     */
    private static ConfirmButton confirmButton;

    /**
     * 打开关于页面的按钮
     */
    private static OpenAboutButton openAboutButton;


    public static ResetButton getResetButton() {
        if(resetButton == null) {
            resetButton = new ResetButton();
            resetButton.setOnAction(ButtonEvent.getResetEvent());
        }
        return resetButton;
    }

    /**
     * @Author: datom
     * @Date: 2021/12/6 18:16
     *
     * @Description: 打开颜色表窗口按钮
     *
     */
    public static ColorsButton getColorsButton() {
        if(colorsButton == null) {
            colorsButton = new ColorsButton();
            colorsButton.setOnAction(ButtonEvent.getOpenColorTableWindowEvent());
        }
        return colorsButton;
    }

    /**
     * @Author: datom
     * @Date: 2021/12/6 18:16
     *
     * @Description: 游戏失败提示确定按钮
     *
     */
    public static ConfirmButton getConfirmButton() {
        if(confirmButton == null) {
            confirmButton = new ConfirmButton();
            confirmButton.setOnAction(ButtonEvent.getGameFailConfirmEvent());
        }
        return confirmButton;
    }

    /**
     * @Author: datom
     * @Date: 2021/12/7 0:26
     *
     * @Description: 获取打开关于页面的按钮
     *
     */
    public static OpenAboutButton getOpenAboutButton() {
        if(openAboutButton == null) {
            openAboutButton = new OpenAboutButton();
            openAboutButton.setOnAction(ButtonEvent.getOpenAboutWindowEvent());
        }
        return openAboutButton;
    }


}
